// pages/xinwen/xinwen.js
Page({
  
  /**
   * 页面的初始数据
   */
  data: {
    type:"",
    selindex:0,
    flag:true,
  },
  getlvyou:function(e){
    var that=this;
    var data=that.data;
    // console.log("1."+data.flag);
    that.setData({type:e.detail.value.word,});
    var fla=false;
    that.setData({flag:fla});
    // console.log("2."+data.flag);
    // console.log(e);
    var type=that.data.type;
    wx.request({
      url: 'https://api.tianapi.com/travel/index',
     
      method:'GET',
      header:{'content-type':'application/x-www-form-urlencoded'},
      data:{
        num:"3",
        word:type,
         key:"c9d0a26283a458989e9e637486f45c2a"
        
      },
      
      success:function(res){
          // console.log(res);
          that.setData({xianshi:res.data.newslist,});
      }
    })
  },
  showmohd:function(){
    var that=this;
    var data=that.data;
    // console.log("1."+data.flag);
    var fla=true;
    that.setData({flag:fla});
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that=this;
    // console.log(e);
    var data=data;
    var type=type;
    wx.request({
      url: 'https://api.tianapi.com/travel/index',
      method:'GET',
      header:{'content-type':'application/x-www-form-urlencoded'},
      data:{
        num:10,
         key:"c9d0a26283a458989e9e637486f45c2a"
      },
      success:function(res){
          // console.log(res);
          that.setData({resultview:res.data.newslist,});
          for(var i=0;i<10;i++){
            if(i==0){
            that.setData({imghdone:res.data.newslist[0].picUrl,texthdone:res.data.newslist[0].title});
          }if(i==1){
            that.setData({imghdtwo:res.data.newslist[6].picUrl,texthdtwo:res.data.newslist[6].title,});
          }if(i==2){
            that.setData({imghdthree:res.data.newslist[2].picUrl,texthdthree:res.data.newslist[2].title,});
          }if(i==3){
            that.setData({imghdfour:res.data.newslist[3].picUrl,texthdfour:res.data.newslist[3].title,});
          }
      }
    }
      })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})